import soot.Unit;

public class IndexNode {
	/**
	 * the boolean variable indicates that whether the current node is a method
	 * call. if the node is a leaf.It's just a simple String line infomation and
	 * value is not null ,method is null. Otherwise method is not null.
	 */
	private boolean isLeaf;
	
	/**
	 * the String value of the line
	 */
	private String value;
	
	/**
	 * the method to be extended.
	 * If the node is a leaf (the field 'isLeaf' is true), it's null;
	 */
	private IndexMethod method;

	/**
	 * the unit of the current node
	 */
	private Unit unit;

	/**
	 * whether we shall record the node
	 * Since there may be duplicate nodes in a path,
	 * some of them will not be recorded when the path is outputted.
	 */
	private boolean shouldRecord;

	public IndexNode(String value, Unit unit, boolean isLeaf) {
		this.value = value;
		this.unit = unit;
		this.isLeaf = isLeaf;
		this.shouldRecord = true;
	}

	public boolean isLeaf() {
		return this.isLeaf;
	}

	public String getValue() {
		return this.value;
	}

	public IndexMethod getMethod() {
		return this.method;
	}

	public void setIsLeaff(boolean isLeaf) {
		this.isLeaf = isLeaf;
	}

	public void setValue(String value) {
		this.value = value;
	}

	public void setMethod(IndexMethod method) {
		this.method = method;
	}

	@Override
	public String toString() {
		return this.value;
	}

	public Unit getUnit() {
		return this.unit;
	}

	public boolean getShouldRecord() {
		return this.shouldRecord;
	}

	public void setShouldRecord(boolean value) {
		this.shouldRecord = value;
	}
}
